package cn.wolfcode.crm.domain;

import com.alibaba.fastjson.JSON;
import lombok.Data;

import java.util.Date;
import java.util.HashMap;

@Data
public class CourseOrder {
    private Long id;
    //录入时间
    private Date inputTime;
    //潜在客户
    private Customer customer;
    //购买课程
    private SystemDictionaryItem course;
    //价格
    private Long money;

    public String getJson() {
        HashMap map = new HashMap();
        map.put("id", id);
        if (customer != null) {
            map.put("customerId", customer.getId());
            map.put("customerName", customer.getName());
        }
        if (course != null) {
            map.put("courseId", course.getId());
            map.put("courseTitle", course.getTitle());
        }
        //将map形式转化为json字符串形式
        return JSON.toJSONString(map);
    }
}